{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
  <!--主要内容开始-->
  <div class="content-wrapper">
{%include file="mail/mail.left.tpl.php"%}
        <!-- /.col -->
	<form name="myform" method="post" action=""  enctype="multipart/form-data">
       <div class="col-md-9">
          <div class="box box-primary">
            <div class="box-header with-border">
              <h3 class="box-title">写邮件</h3>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
              <div class="form-group">
									   <input name="mail_to" id="staff_name" type="text" class="form-control" value="{%$mail_data.mail_fromname%}" autocomplete="off" placeholder="收件人:">
									   <input name="mail_to" id="staff_id" type="hidden" class="form-control" value="{%$mail_data.mail_from%}">
              </div>
              <div class="form-group">
                <input name="mail_title" value="{%$mail_title%}" class="form-control" placeholder="主题:">
              </div>
              <div class="form-group">
                     <textarea id="mail_content" name="mail_content" rows="22" cols="40" style="width: 100%">{%$mail_content%}</textarea>
              </div>
             </div>
			{%if $mail_data.mail_file!=""%}
            <div class="box-footer">
              <ul class="mailbox-attachments clearfix">
				{%foreach from=$mail_data.mail_file key=key item=value%}
                <li>

                  <div class="mailbox-attachment-info">
                    <a href="index.php?a=mail.file&mail_id={%$mail_id%}&fname={%$value.fname%}" class="mailbox-attachment-name"><i class="fa fa-paperclip"></i> {%$value.fname%}</a>
                        <span class="mailbox-attachment-size">
                          {%$value.fsize%} KB
                          <a href="index.php?a=mail.file&mail_id={%$mail_id%}&fname={%$value.fname%}" class="btn btn-default btn-xs pull-right"><i class="fa fa-cloud-download"></i></a>
                        </span>
                  </div>
                </li>
				{%/foreach%}
              </ul>
            </div>
			{%else%}

              <div class="form-group" style="padding-left:10px;">
                <div class="btn btn-default btn-file">
                  <i class="fa fa-paperclip"></i> 附件
                  <input type="file" name="mail_file" >
                </div>
                <p class="help-block">最大不要超过32MB</p>
              </div>
			{%/if%}

            <div class="box-footer">
              <div class="pull-right">
                  <input type="hidden" name="type" value="{%$type%}">
			    <input type="hidden" name="MAX_FILE_SIZE" value="40960000">
                <button type="submit" class="btn btn-primary"><i class="fa fa-envelope-o"></i> 发送</button>
              </div>
              <button type="reset" class="btn btn-default"><i class="fa fa-times"></i> 重置</button>
            </div>
            <!-- /.box-footer -->
          </div>
          <!-- /. box -->
    
        </div>
		</form>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
{%include file="index.footer.tpl.php"%}

<script src="static/js/icheck.min.js"></script><!--邮箱-->

<!--编辑器-->
<script type="text/javascript" src="static/xhe/xheditor-1.2.2.min.js"></script>
<script type="text/javascript" src="static/xhe/xheditor_lang/zh-cn.js"></script>
<script type="text/javascript">
$(pageInit);
function pageInit()
{
	$.extend(XHEDITOR.settings,{shortcuts:{'ctrl+enter':submitForm}});//修改默认设置
	$('#mail_content').xheditor({modalWidth:700,modalHeight:500,upBtnText:'浏览',upLinkUrl:"!ckfinder/upload.html",upImgUrl:"!ckfinder/upload.html?type=Images",upFlashUrl:"!ckfinder/upload.html?type=Flash",upMediaUrl:"!ckfinder/upload.html"});
}
function submitForm(){$('#myform').submit();}<!-- Page Script -->
</script>
<script src="static/js/run_prettify.js"></script>
<script src="static/js/jquery.mockjax.js"></script>
<script src="static/js/bootstrap-typeahead.js"></script>
 <script>
		$(function() {
			function displayResult(item) {
				$("#staff_id").val(item.value);
				if(item.value > 0){
				//window.location.href="index.php?a=staff.subjectupdate&staff_id="+item.value;
				}
			}
			$('#staff_name').typeahead({
			 source: [
			{%foreach from=$staff_lists key=key item=value%}
            { id: {%$value.staff_id%}, name: '{%$value.staff_name%}' },
			{%/foreach%}
        ],

				onSelect: displayResult,
			});
		  
		});
	</script>